package com.cloud.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.common.entity.ShopOrder;
import com.cloud.order.dao.ShopOrderDao;
import com.cloud.order.service.ShopOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 订单表 服务实现类
 * </p>
 *
 * @author 李均华
 * @since 2021-06-04
 */
@Service
@Slf4j
public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderDao, ShopOrder> implements ShopOrderService {

    @Override
    public ShopOrder order(Integer id,Integer num) {
        log.info("用户下单，商品id=" + id);
        ShopOrder shopOrder = new ShopOrder()
                .setShopProductId(id)
                .setNum(num);
        this.save(shopOrder);
        return shopOrder;
    }
}
